import java.util.Scanner;

/**
 * Created by haiqiang on 17/10/1.
 */
public class Retirement {
    public static void main(String[] args) {
        //read inputs
        Scanner in = new Scanner(System.in);

        System.out.println("How much money do you need to retire?");
        double goal = in.nextDouble();

        System.out.println("How much money will you contribute every year");
        double payment = in.nextDouble();

        System.out.println("Interest rate in %:");
        double rate = in.nextDouble();

        double balance = 0;
        int years = 0;

        //update account balance while goal is not reached
        while(balance < goal) {
            //add this year's payment and interest
            balance = balance + payment;
            double interest = balance * rate /100;
            balance = balance + interest;
            years++;
        }

        System.out.println("You can retire in " + years + " years");
    }
}
